import { rest } from './index'
// import md5 from 'js-md5/build/md5.min'

const Api = {
  planList: '/api/strategy/list',
  deletePlan: '/api/strategy',
  addPlan: '/api/strategy',
  editPlan: '/api/strategy',
  getK3List: '/api/k3/strategy',
  addK3: '/api/k3/strategy',
  deleteK3: '/api/k3/strategy',

  startK3: '/api/k3/task',
  stopK3: '/api/k3/task',

  // RB
  getRBList: '/api/redBlack/strategy',
  startRB: '/api/redBlack/task',
  stopRB: '/api/redBlack/task',
  addRB: '/api/redBlack/strategy',
  deleteRB: '/api/redBlack/strategy'

}

export default {
  /*
  * 策略
  * **/
  getPlanList (parame) {
    return rest.post(Api.planList, parame)
  },
  deletePlan (parame) {
    return rest.delete(Api.deletePlan, parame)
  },
  addPlan (parame) {
    return rest.post(Api.deletePlan, parame)
  },
  editPlan (id, parame) {
    return rest.put(Api.editPlan, id, parame)
  },
  /***
   * K3
   * */
  startK3 () {
    return rest.post(Api.startK3)
  },
  stopK3 () {
    return rest.delete(Api.stopK3)
  },
  getK3List (parame) {
    return rest.get(Api.getK3List, parame)
  },
  addK3 (parame) {
    return rest.post(Api.getK3List + '/' + parame.id)
  },
  deleteK3 (parame) {
    return rest.delete(Api.deleteK3, parame)
  },
  /**
   * RB
   * */
  startRB () {
    return rest.post(Api.startK3)
  },
  stopRB () {
    return rest.delete(Api.stopK3)
  },
  getRBList (parame) {
    return rest.get(Api.getRBList, parame)
  },
  addRB (parame) {
    return rest.post(Api.addRB + '/' + parame.id)
  },
  deleteRB (parame) {
    return rest.delete(Api.deleteRB, parame)
  }
}
